<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - VectorField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../../../lib/yui/reset/reset-min.css">
<link rel="stylesheet" type="text/css" href="../../../lib/yui/fonts/fonts-min.css">
<link rel="stylesheet" type="text/css" href="../../../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../../../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../../../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="../../../examples/css/demo.css"/>
<link rel="stylesheet" type="text/css" href="../../../examples/css/dpSyntaxHighlighter.css">

 </head>

 <body>

<p class='demoTitle'>inputEx - VectorField Usage</p>


<!-- Example 1 -->
<div class='exampleDiv'>

	<p class="title">Basic VectorField creation</p>
	
	<p>Use the following code to create a basic inputEx VectorField.</p>

	<div class='demoContainer' id='container1'></div>

	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			var field = new YAHOO.inputEx.VectorField({parentEl: 'container1', value: [-10.4,13*2]});
		</textarea>
	</div>

</div>


<!-- Example 2 -->
<div class='exampleDiv'>

	<p class="title">VectorField with separators</p>
	
	<p>VectorField inherits CombineField, so you can change the separators :</p>

	<div class='demoContainer' id='container2'></div>

	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			new YAHOO.inputEx.VectorField({
				parentEl: 'container2', 
				value: [-10.4,13*2],
				separators: ["x:",", y:", null]
			});
		</textarea>
	</div>

</div>


<!-- Example 3 -->
<div class='exampleDiv'>

	<p class="title">VectorField dimension</p>
	
	<p>Set the dimension option :</p>

	<div class='demoContainer' id='container3'></div>

	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			new YAHOO.inputEx.VectorField({
				parentEl: 'container3', 
				value: [-1, 0, 1],
				dimension: 3,
				separators: ["x:",", y:", ", z: ", null]
			});
		</textarea>
	</div>

</div>


<!-- YUI Library -->
<script type="text/javascript" src="../../../lib/yui/yahoo/yahoo-min.js"></script> 
<script type="text/javascript" src="../../../lib/yui/dom/dom-min.js"></script> 
<script type="text/javascript" src="../../../lib/yui/event/event-min.js"></script>
<script type="text/javascript" src="../../../lib/yui/container/container-min.js"></script>

<!-- InputEx -->
<script src="../../inputex.js"  type='text/javascript'></script>
<script src="../../Field.js"  type='text/javascript'></script>
<script src="../../fields/StringField.js"  type='text/javascript'></script>
<script src="../../fields/NumberField.js"  type='text/javascript'></script>
<script src="../../fields/CombineField.js"  type='text/javascript'></script>
<script src="VectorField.js"  type='text/javascript'></script>

<script>

YAHOO.util.Event.addListener(window, 'load', function() {

	// Example 1
	var field = new YAHOO.inputEx.VectorField({parentEl: 'container1', value: [-10.4,13*2]});
	
	var el = YAHOO.util.Dom.get('container1');

	var button1 = YAHOO.inputEx.cn('button', null, null, "SetValue");
	el.appendChild(button1);
	YAHOO.util.Event.addListener(button1, "click" ,function() {
	   field.setValue([-42.42,12.603]);
	});
	
	var logDiv = YAHOO.inputEx.cn('div', null, null, "Log :<br />");
	el.appendChild(logDiv);
	field.updatedEvt.subscribe(function(e,params) {
		var value = params[0];
		logDiv.innerHTML += "Updated at "+(new Date())+" with value "+value+"<br />";
	});
   
	// Example 2
	new YAHOO.inputEx.VectorField({
		parentEl: 'container2', 
		value: [-10.4,13*2],
		separators: ["x:",", y:", null]
	});
	
	// Example 3
	new YAHOO.inputEx.VectorField({
		parentEl: 'container3', 
		value: [-1, 0, 1],
		dimension: 3,
		separators: ["x:",", y:", ", z: ", null]
	});
	
});

</script>

<script src="../../../examples/js/dpSyntaxHighlighter.js"></script>
<script language="javascript"> 
dp.SyntaxHighlighter.HighlightAll('code');
</script>

 </body>
</html>